home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Online / Apache / include / php / main / php.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-12-07  |  8.7 KB  |  340 lines

  1. /* 
  2.    +----------------------------------------------------------------------+
  3.    | PHP version 4.0                                                      |
  4.    +----------------------------------------------------------------------+
  5.    | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group                   |
  6.    +----------------------------------------------------------------------+
  7.    | This source file is subject to version 2.02 of the PHP license,      |
  8.    | that is bundled with this package in the file LICENSE, and is        |
  9.    | available at through the world-wide-web at                           |
  10.    | http://www.php.net/license/2_02.txt.                                 |
  11.    | If you did not receive a copy of the PHP license and are unable to   |
  12.    | obtain it through the world-wide-web, please send a note to          |
  13.    | license@php.net so we can mail you a copy immediately.               |
  14.    +----------------------------------------------------------------------+
  15.    | Authors: Andi Gutmans <andi@zend.com>                                |
  16.    |          Zeev Suraski <zeev@zend.com>                                |
  17.    +----------------------------------------------------------------------+
  18.  */
  19.  
  20. /* $Id: php.h,v 1.127.2.2 2000/12/07 19:15:03 sas Exp $ */
  21.  
  22. #ifndef PHP_H
  23. #define PHP_H
  24.  
  25. #ifdef HAVE_DMALLOC
  26. #include <dmalloc.h>
  27. #endif
  28.  
  29. #define PHP_API_VERSION 19990421
  30.  
  31. #define YYDEBUG 0
  32.  
  33. #include "php_version.h"
  34. #include "zend.h"
  35. #include "php_compat.h"
  36.  
  37. #include "zend_API.h"
  38.  
  39. #if PHP_BROKEN_SPRINTF
  40. #undef sprintf
  41. #define sprintf php_sprintf
  42. #endif
  43.  
  44. extern unsigned char first_arg_force_ref[];   
  45. extern unsigned char first_arg_allow_ref[];
  46. extern unsigned char second_arg_force_ref[];
  47. extern unsigned char second_arg_allow_ref[];
  48.  
  49. #ifdef PHP_WIN32
  50. #include "win95nt.h"
  51. #    ifdef PHP_EXPORTS
  52. #    define PHPAPI __declspec(dllexport) 
  53. #    else
  54. #    define PHPAPI __declspec(dllimport) 
  55. #    endif
  56. #define PHP_DIR_SEPARATOR '\\'
  57. #else
  58. #define PHPAPI
  59. #define THREAD_LS
  60. #define PHP_DIR_SEPARATOR '/'
  61. #endif
  62.  
  63. #include "php_regex.h"
  64.  
  65. /* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
  66. #undef PHP_DEBUG
  67. #define PHP_DEBUG ZEND_DEBUG
  68.  
  69.  
  70. #define APACHE 0
  71. #define CGI_BINARY 0
  72.  
  73. #if HAVE_UNIX_H
  74. #include <unix.h>
  75. #endif
  76.  
  77. #if HAVE_ALLOCA_H
  78. #include <alloca.h>
  79. #endif
  80.  
  81. /*
  82.  * This is a fast version of strlcpy which should be used, if you
  83.  * know the size of the destination buffer and if you know
  84.  * the length of the source string.
  85.  *
  86.  * size is the allocated number of bytes of dst
  87.  * src_size is the number of bytes excluding the NUL of src
  88.  */
  89.  
  90. #define PHP_STRLCPY(dst, src, size, src_size)    \
  91.     {                                            \
  92.         size_t php_str_len;                        \
  93.                                                 \
  94.         if (src_size >= size)                    \
  95.             php_str_len = size - 1;                \
  96.         else                                    \
  97.             php_str_len = src_size;                \
  98.         memcpy(dst, src, php_str_len);            \
  99.         dst[php_str_len] = '\0';                \
  100.     }
  101.  
  102. #ifndef HAVE_STRLCPY
  103. PHPAPI size_t strlcpy(char *dst, const char *src, size_t siz);
  104. #endif
  105.  
  106. #ifndef HAVE_STRLCAT
  107. PHPAPI size_t strlcat(char *dst, const char *src, size_t siz);
  108. #endif
  109.  
  110. #ifndef HAVE_STRTOK_R
  111. char *strtok_r(char *s, const char *delim, char **last);
  112. #endif
  113.  
  114. #ifndef HAVE_SOCKLEN_T
  115. typedef unsigned int socklen_t;
  116. #endif
  117.  
  118. #define CREATE_MUTEX(a,b)
  119. #define SET_MUTEX(a)
  120. #define FREE_MUTEX(a)
  121.  
  122. /*
  123.  * Then the ODBC support can use both iodbc and Solid,
  124.  * uncomment this.
  125.  * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
  126.  */
  127.  
  128. #include <stdlib.h>
  129. #include <ctype.h>
  130. #if HAVE_UNISTD_H
  131. #include <unistd.h>
  132. #endif
  133. #if HAVE_STDARG_H
  134. #include <stdarg.h>
  135. #else   
  136. # if HAVE_SYS_VARARGS_H
  137. # include <sys/varargs.h>
  138. # endif 
  139. #endif 
  140.  
  141.  
  142. #include "zend_hash.h"
  143. #include "php3_compat.h"
  144. #include "zend_alloc.h"
  145. #include "zend_stack.h"
  146.  
  147. #if STDC_HEADERS
  148. # include <string.h>
  149. #else
  150. # ifndef HAVE_MEMCPY
  151. #  define memcpy(d, s, n)    bcopy((s), (d), (n))
  152. # endif
  153. # ifndef HAVE_MEMMOVE
  154. #  define memmove(d, s, n)    bcopy ((s), (d), (n))
  155. # endif
  156. #endif
  157.  
  158. #include "safe_mode.h"
  159.  
  160. #ifndef HAVE_STRERROR
  161. char *strerror(int);
  162. #endif
  163.  
  164. #include "fopen-wrappers.h"
  165.  
  166. #if (REGEX == 1 || REGEX == 0) && !defined(NO_REGEX_EXTRA_H)
  167. #include "regex/regex_extra.h"
  168. #endif
  169.  
  170. #if HAVE_PWD_H
  171. # ifdef PHP_WIN32
  172. #include "win32/pwd.h"
  173. #include "win32/param.h"
  174. # else
  175. #include <pwd.h>
  176. #include <sys/param.h>
  177. # endif
  178. #endif
  179.  
  180. #if HAVE_LIMITS_H
  181. #include <limits.h>
  182. #endif
  183.  
  184. #ifndef LONG_MAX
  185. #define LONG_MAX 2147483647L
  186. #endif
  187.  
  188. #ifndef LONG_MIN
  189. #define LONG_MIN (- LONG_MAX - 1)
  190. #endif
  191.  
  192. #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || defined(BROKEN_SPRINTF)
  193. #include "snprintf.h"
  194. #endif
  195.  
  196. #define EXEC_INPUT_BUF 4096
  197.  
  198. #define PHP_MIME_TYPE "application/x-httpd-php"
  199.  
  200. /* macros */
  201. #define STR_PRINT(str)    ((str)?(str):"")
  202.  
  203. #ifndef MAXPATHLEN
  204. # ifdef PATH_MAX
  205. #  define MAXPATHLEN PATH_MAX
  206. # else
  207. #  define MAXPATHLEN 256    /* Should be safe for any weird systems that do not define it */
  208. # endif
  209. #endif
  210.  
  211. #define PHP_FN(name) php_if_##name
  212. #define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
  213. #define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(PHP_FN(name))
  214.  
  215. #define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types },
  216. #define PHP_FE(name, arg_types) PHP_NAMED_FE(name, PHP_FN(name), arg_types)
  217. #define PHP_FALIAS(name, alias, arg_types) PHP_NAMED_FE(name, PHP_FN(alias), arg_types)
  218. #define PHP_STATIC_FE(php_name, func_name, arg_types) { php_name, func_name, arg_types },
  219.  
  220. #define PHP_MINIT(module)    php_minit_##module
  221. #define PHP_MSHUTDOWN(module)    php_mshutdown_##module
  222. #define PHP_RINIT(module)    php_rinit_##module
  223. #define PHP_RSHUTDOWN(module)    php_rshutdown_##module
  224. #define PHP_MINFO(module)    php_info_##module
  225. #define PHP_GINIT(module)    php_ginit_##module
  226. #define PHP_GSHUTDOWN(module)    php_gshutdown_##module
  227.  
  228. #define PHP_MINIT_FUNCTION(module)    int PHP_MINIT(module)(INIT_FUNC_ARGS)
  229. #define PHP_MSHUTDOWN_FUNCTION(module)    int PHP_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
  230. #define PHP_RINIT_FUNCTION(module)    int PHP_RINIT(module)(INIT_FUNC_ARGS)
  231. #define PHP_RSHUTDOWN_FUNCTION(module)    int PHP_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
  232. #define PHP_MINFO_FUNCTION(module)    void PHP_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS)
  233. #define PHP_GINIT_FUNCTION(module)    int PHP_GINIT(module)(GINIT_FUNC_ARGS)
  234. #define PHP_GSHUTDOWN_FUNCTION(module)    int PHP_GSHUTDOWN(module)(void)
  235.  
  236.  
  237. /* global variables */
  238. extern pval *data;
  239. #if !defined(PHP_WIN32)
  240. extern char **environ;
  241. #define php_sleep sleep
  242. #endif
  243.  
  244. void phperror(char *error);
  245. PHPAPI int php_write(void *buf, uint size);
  246. PHPAPI int php_printf(const char *format, ...);
  247. void php_log_err(char *log_message);
  248. int Debug(char *format, ...);
  249. int cfgparse(void);
  250.  
  251. #define php_error zend_error
  252.  
  253. #define zenderror phperror
  254. #define zendlex phplex
  255.  
  256. #define phpparse zendparse
  257. #define phprestart zendrestart
  258. #define phpin zendin
  259.  
  260. /* functions */
  261. int php_startup_internal_extensions(void);
  262. int php_global_startup_internal_extensions(void);
  263. int php_global_shutdown_internal_extensions(void);
  264.  
  265. int php_mergesort(void *base, size_t nmemb, register size_t size, int (*cmp) (const void *, const void *));
  266.  
  267. PHPAPI void php_register_pre_request_shutdown(void (*func)(void *), void *userdata);
  268.  
  269. PHPAPI int cfg_get_long(char *varname, long *result);
  270. PHPAPI int cfg_get_double(char *varname, double *result);
  271. PHPAPI int cfg_get_string(char *varname, char **result);
  272.  
  273.  
  274. /* Output support */
  275. #include "ext/standard/php_output.h"
  276. #define PHPWRITE(str, str_len)        php_body_write((str), (str_len))
  277. #define PUTS(str)                    php_body_write((str), strlen((str)))
  278. #define PUTC(c)                        (php_body_write(&(c), 1), (c))
  279. #define PHPWRITE_H(str, str_len)    php_header_write((str), (str_len))
  280. #define PUTS_H(str)                    php_header_write((str), strlen((str)))
  281. #define PUTC_H(c)                    (php_header_write(&(c), 1), (c))
  282.  
  283. #ifdef ZTS
  284. #define VIRTUAL_DIR
  285. #endif
  286.  
  287. /* Virtual current working directory support */
  288. #include "tsrm_virtual_cwd.h"
  289.  
  290. #include "zend_constants.h"
  291.  
  292. /* connection status states */
  293. #define PHP_CONNECTION_NORMAL  0
  294. #define PHP_CONNECTION_ABORTED 1
  295. #define PHP_CONNECTION_TIMEOUT 2
  296.  
  297. #include "php_reentrancy.h"
  298.  
  299. /* Finding offsets of elements within structures.
  300.  * Taken from the Apache code, which in turn, was taken from X code...
  301.  */
  302.  
  303. #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
  304. #ifdef __STDC__
  305. #define XtOffset(p_type,field) _Offsetof(p_type,field)
  306. #else
  307. #ifdef CRAY2
  308. #define XtOffset(p_type,field) \
  309.     (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
  310.  
  311. #else /* !CRAY2 */
  312.  
  313. #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
  314.  
  315. #endif /* !CRAY2 */  
  316. #endif /* __STDC__ */
  317. #else /* ! (CRAY || __arm) */
  318.  
  319. #define XtOffset(p_type,field) \
  320.     ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
  321.  
  322. #endif /* !CRAY */
  323.  
  324. #ifdef offsetof
  325. #define XtOffsetOf(s_type,field) offsetof(s_type,field)
  326. #else
  327. #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
  328. #endif
  329.  
  330. PHPAPI PHP_FUNCTION(warn_not_available);
  331.  
  332. #endif
  333.  
  334. /*
  335.  * Local variables:
  336.  * tab-width: 4
  337.  * c-basic-offset: 4
  338.  * End:
  339.  */
  340.